﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Diploma.Models;

namespace DiplomaWeb.Models.CompaniesAndLecturers
{
    public class StudentGroupsViewModel
    {
        public IEnumerable<GroupViewModel> Groups { get; set; }

        public StudentGroupsViewModel() {}

        public StudentGroupsViewModel(IEnumerable<StudentsGroup> groups)
        {
            ToViewModel(groups);
        }

        public void ToViewModel(IEnumerable<StudentsGroup> groups)
        {
            Groups = groups.Select(r => new GroupViewModel
                                            {
                                                Id = r.StudentsGroupId.ToString(),
                                                Name = r.Name
                                            });
        }
    }
}